package com.freejava.test_roles.mapper;

import com.freejava.test_roles.entity.Role;
import com.freejava.test_roles.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from r_roles as r join r_user_roles as ur on r.id=ur.user_id where ur.user_id=#{id}")
    List<Role> getUserRoleByUserId(Integer id);

    @Select("select * from r_users where username = #{username}")
    User getUserByUsername(String username);
}
